﻿@model IEnumerable<Common.Product>
           
@if (Model.Count() > 0)
{
    <br /> <div style="color: Black"><b>@ViewBag.Message</b></div> <br />
    <table>
        <tr>
            <th>Product Name</th>
            <th>Features</th>
            <th>Image</th>
            <th>Quantity</th>
            <th>Price</th>
            <th>Date Listed</th>
        </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>@Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Features)
            </td>
            <td>
                <img height="150px" width="150px" src= "@Url.Content(item.Image)" alt="@Html.DisplayFor(modelItem => item.Image)" />
            </td>
            <td>
                @if (item.Stock == 0)
                {
                    <span>Out of stock!</span>
                }
                else
                {
                    @Html.DisplayFor(modelItem => item.Stock)
                }
            </td>
            <td>
                €@Html.DisplayFor(modelItem => item.Price)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DateListed)
            </td>
        </tr>
    }
</table>
}
else
{
    <br /> <div style="color: Red"><b>No products found</b></div>
}